<%--
    Document   : home
    Created on : 28/07/2011, 11:40:58 AM
    Author     : David Bullock 42062222
--%>


<%@ include file="../header.jsp" %>

<div id="content-container">
    <div id="content">
        <!-- Content goes here -->
        <!-- for loop iterating through poll list-->
        <h3 align="center"> </h3><!--making a space between table and header-->
         <div id="tablecontainer">
            <table class="gentable" cellpadding="2">
                <tr >
                    <th>Poll Name</th>
                    <th>Closed</th>               
                </tr>
                <c:forEach items="${polls}" var="poll">
                    <tr>
                        <td>
                            <a href="./showPoll.html?pid=<c:out value="${poll.getId()}"/>"><c:out value="${poll.getName()}"/></th></a>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${poll.isOpen()}"> Open</c:when>
                                <c:otherwise> Closed</c:otherwise>
                            </c:choose>
                        </td>
                        <td>
                            <c:choose>
                                <c:when test="${poll.isOpen()}">
                                    <a href="./viewactiveuser.html?pollID=<c:out value="${poll.getId()}"/>">Message participants</a>
                                </c:when>
                                <c:otherwise>
                                    <a href="./viewList.html?tempID=<c:out value="${poll.getId()}"/>">View Participant List</a></br>
                                    
                                </c:otherwise>
                            </c:choose>
                        </td>                
                    </tr>

                </c:forEach>
            </table>
         </div>
    </div>
</div>
<%@ include file="../footer.jsp" %>